This study tried to examine the effects of change attitudes of HR
department (University of Tehran) on organizational innovation and
happiness. The total population of the present study was 348 employees
(HR departments) of the University of Tehran. 219 (62.9%) of the
respondents were male and 129 (37.1%) were female. We also know about
their duration of employment or work experience in years
(experience).
The questionnaire items use a 5-level Likert scale from 1 to 5 (strongly disagree = 1, disagree = 2, have no opinion = 3, agree = 4 and strongly agree = 5).
Independent variables:
Dependent variables
Moreover, the questionnaire on organizational happiness suggests that if the staff think of their workplace as a learning environment in which they can positively participate in a meaningful interesting job, organizational happiness will take place.
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.8
## ✓ tidyr 1.2.0 ✓ stringr 1.4.0
## ✓ readr 2.1.2 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(summarytools) # dfSummary(), descr(), freq()
##
## Attaching package: 'summarytools'
## The following object is masked from 'package:tibble':
##
## view
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(performance)
# packages with additional graphics options
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
## The following object is masked from 'package:dplyr':
##
## recode
## The following object is masked from 'package:purrr':
##
## some
library(GGally)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
library(cowplot)
data <- read_csv("students/data/Keshavarz_1_HR.csv")
## Rows: 348 Columns: 51
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (51): Gender, experience, q01, q02, q03, q04, q05, q06, q07, q08, q09, q...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
spec(data)
## cols(
## Gender = col_double(),
## experience = col_double(),
## q01 = col_double(),
## q02 = col_double(),
## q03 = col_double(),
## q04 = col_double(),
## q05 = col_double(),
## q06 = col_double(),
## q07 = col_double(),
## q08 = col_double(),
## q09 = col_double(),
## q10 = col_double(),
## q11 = col_double(),
## q12 = col_double(),
## q13 = col_double(),
## q14 = col_double(),
## q15 = col_double(),
## q16 = col_double(),
## q17 = col_double(),
## q18 = col_double(),
## q19 = col_double(),
## q20 = col_double(),
## q21 = col_double(),
## q22 = col_double(),
## q23 = col_double(),
## q24 = col_double(),
## q25 = col_double(),
## q26 = col_double(),
## q27 = col_double(),
## q28 = col_double(),
## q29 = col_double(),
## q30 = col_double(),
## q31 = col_double(),
## q32 = col_double(),
## q33 = col_double(),
## q34 = col_double(),
## q35 = col_double(),
## q36 = col_double(),
## q37 = col_double(),
## q38 = col_double(),
## q39 = col_double(),
## q40 = col_double(),
## q41 = col_double(),
## q42 = col_double(),
## q43 = col_double(),
## q44 = col_double(),
## q45 = col_double(),
## q46 = col_double(),
## q47 = col_double(),
## q48 = col_double(),
## q49 = col_double()
## )
#view(dfSummary(data))
descr(data, stats="common")
## Descriptive Statistics
## data
## N: 348
##
## experience Gender q01 q02 q03 q04 q05 q06 q07
## --------------- ------------ -------- -------- -------- -------- -------- -------- -------- --------
## Mean 4.22 1.37 4.07 4.17 4.21 4.57 4.24 1.61 2.22
## Std.Dev 1.23 0.48 1.14 1.13 1.18 0.83 1.00 0.72 1.10
## Min 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
## Median 4.00 1.00 4.00 5.00 5.00 5.00 4.50 1.00 2.00
## Max 6.00 2.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
##
## Table: Table continues below
##
##
##
## q08 q09 q10 q11 q12 q13 q14 q15 q16
## --------------- -------- -------- -------- -------- -------- -------- -------- -------- --------
## Mean 4.34 3.39 4.04 4.34 3.85 3.89 4.17 4.50 4.28
## Std.Dev 0.99 1.03 0.97 0.85 1.08 1.06 1.05 0.74 0.92
## Min 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
## Median 5.00 3.00 4.00 5.00 4.00 4.00 4.00 5.00 5.00
## Max 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
##
## Table: Table continues below
##
##
##
## q17 q18 q19 q20 q21 q22 q23 q24 q25
## --------------- -------- -------- -------- -------- -------- -------- -------- -------- --------
## Mean 4.38 4.15 3.55 4.43 4.36 4.31 3.82 4.31 4.62
## Std.Dev 0.75 0.94 0.90 0.84 0.84 0.79 0.89 0.75 0.65
## Min 1.00 1.00 1.00 1.00 2.00 1.00 1.00 2.00 1.00
## Median 5.00 4.00 3.00 5.00 5.00 4.00 4.00 4.00 5.00
## Max 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
##
## Table: Table continues below
##
##
##
## q26 q27 q28 q29 q30 q31 q32 q33 q34
## --------------- -------- -------- -------- -------- -------- -------- -------- -------- --------
## Mean 4.39 3.74 2.77 2.66 2.99 2.75 2.49 2.83 2.89
## Std.Dev 0.80 1.20 1.08 1.18 1.21 1.30 1.11 1.06 1.03
## Min 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
## Median 5.00 4.00 3.00 3.00 3.00 3.00 2.00 3.00 3.00
## Max 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
##
## Table: Table continues below
##
##
##
## q35 q36 q37 q38 q39 q40 q41 q42 q43
## --------------- -------- -------- -------- -------- -------- -------- -------- -------- --------
## Mean 2.71 3.05 3.05 2.77 2.73 3.34 2.73 3.12 3.63
## Std.Dev 1.24 1.13 1.06 1.10 1.18 1.06 1.17 1.11 1.04
## Min 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
## Median 2.50 3.00 3.00 2.00 3.00 3.00 2.00 3.00 4.00
## Max 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00 100.00
##
## Table: Table continues below
##
##
##
## q44 q45 q46 q47 q48 q49
## --------------- -------- -------- -------- -------- -------- --------
## Mean 3.78 3.15 3.52 3.39 3.50 3.55
## Std.Dev 0.91 1.12 1.04 0.99 0.88 0.97
## Min 1.00 1.00 1.00 1.00 1.00 1.00
## Median 4.00 3.00 4.00 4.00 4.00 4.00
## Max 5.00 5.00 5.00 5.00 5.00 5.00
## N.Valid 348.00 348.00 348.00 348.00 348.00 348.00
## Pct.Valid 100.00 100.00 100.00 100.00 100.00 100.00
glimpse(data)
## Rows: 348
## Columns: 51
## $ Gender <dbl> 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,…
## $ experience <dbl> 5, 3, 3, 4, 6, 4, 2, 2, 3, 3, 4, 3, 3, 3, 3, 4, 5, 6, 3, 3,…
## $ q01 <dbl> 3, 1, 5, 5, 5, 3, 4, 4, 3, 5, 5, 5, 4, 5, 5, 2, 5, 4, 5, 5,…
## $ q02 <dbl> 5, 4, 5, 5, 5, 3, 4, 3, 4, 4, 4, 5, 5, 2, 2, 2, 5, 2, 5, 3,…
## $ q03 <dbl> 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 4, 5, 2, 5, 3,…
## $ q04 <dbl> 5, 5, 5, 5, 5, 5, 5, 4, 4, 5, 5, 5, 5, 4, 4, 5, 5, 1, 4, 3,…
## $ q05 <dbl> 4, 4, 4, 5, 4, 1, 4, 5, 4, 5, 5, 4, 4, 4, 4, 2, 5, 4, 4, 3,…
## $ q06 <dbl> 2, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 3, 2,…
## $ q07 <dbl> 1, 1, 2, 1, 1, 4, 2, 4, 4, 4, 2, 2, 1, 4, 4, 2, 1, 1, 3, 2,…
## $ q08 <dbl> 5, 5, 5, 5, 5, 4, 3, 5, 5, 5, 5, 4, 3, 5, 5, 2, 5, 1, 4, 2,…
## $ q09 <dbl> 4, 5, 5, 3, 2, 4, 4, 5, 4, 4, 5, 1, 2, 4, 4, 2, 3, 2, 3, 2,…
## $ q10 <dbl> 4, 5, 4, 5, 5, 4, 5, 2, 4, 4, 5, 5, 4, 2, 4, 4, 5, 3, 4, 2,…
## $ q11 <dbl> 4, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 5, 5, 4, 4, 4, 5, 4, 4, 2,…
## $ q12 <dbl> 4, 2, 5, 4, 4, 5, 4, 5, 4, 2, 5, 4, 4, 2, 4, 4, 5, 3, 4, 2,…
## $ q13 <dbl> 3, 5, 5, 4, 4, 1, 5, 4, 4, 4, 5, 4, 4, 2, 3, 2, 3, 1, 5, 3,…
## $ q14 <dbl> 4, 5, 4, 5, 5, 4, 5, 3, 4, 5, 5, 5, 3, 4, 5, 4, 5, 3, 5, 3,…
## $ q15 <dbl> 4, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 4, 4, 5, 4, 5, 5, 4, 2,…
## $ q16 <dbl> 4, 1, 5, 5, 5, 5, 4, 3, 4, 3, 5, 5, 4, 4, 5, 4, 5, 4, 4, 2,…
## $ q17 <dbl> 5, 5, 4, 5, 5, 5, 5, 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 3, 4, 2,…
## $ q18 <dbl> 5, 5, 4, 5, 5, 5, 5, 4, 4, 2, 5, 5, 4, 4, 5, 4, 5, 1, 5, 2,…
## $ q19 <dbl> 3, 5, 4, 4, 5, 3, 5, 3, 4, 3, 5, 5, 3, 3, 4, 4, 5, 3, 4, 2,…
## $ q20 <dbl> 4, 5, 5, 4, 5, 5, 5, 3, 5, 5, 4, 5, 4, 5, 5, 4, 5, 3, 4, 2,…
## $ q21 <dbl> 5, 5, 5, 5, 5, 4, 4, 3, 4, 3, 5, 5, 4, 5, 5, 4, 5, 4, 5, 2,…
## $ q22 <dbl> 5, 5, 4, 4, 5, 5, 4, 3, 4, 4, 5, 4, 4, 4, 5, 4, 5, 5, 5, 1,…
## $ q23 <dbl> 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 4, 2,…
## $ q24 <dbl> 4, 5, 5, 4, 5, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 4, 5, 4, 4, 2,…
## $ q25 <dbl> 5, 5, 5, 5, 5, 2, 4, 5, 4, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 2,…
## $ q26 <dbl> 4, 5, 4, 4, 5, 5, 4, 2, 5, 3, 4, 5, 4, 5, 5, 4, 3, 5, 1, 3,…
## $ q27 <dbl> 4, 4, 4, 3, 1, 3, 4, 3, 2, 4, 4, 4, 3, 2, 2, 4, 3, 3, 1, 4,…
## $ q28 <dbl> 4, 4, 4, 3, 2, 1, 3, 1, 1, 4, 3, 3, 2, 4, 5, 1, 1, 3, 2, 3,…
## $ q29 <dbl> 4, 4, 4, 1, 1, 1, 2, 1, 1, 4, 2, 3, 2, 4, 4, 2, 1, 4, 1, 3,…
## $ q30 <dbl> 4, 5, 4, 3, 1, 1, 1, 1, 2, 4, 3, 3, 2, 2, 2, 2, 1, 3, 3, 3,…
## $ q31 <dbl> 3, 4, 5, 4, 1, 1, 1, 2, 2, 2, 3, 3, 2, 2, 5, 2, 1, 1, 4, 3,…
## $ q32 <dbl> 5, 5, 4, 2, 2, 1, 1, 3, 2, 1, 4, 3, 1, 2, 5, 1, 1, 1, 2, 3,…
## $ q33 <dbl> 4, 4, 4, 3, 1, 2, 2, 3, 1, 4, 3, 3, 2, 4, 4, 1, 1, 3, 3, 2,…
## $ q34 <dbl> 3, 4, 4, 3, 4, 3, 1, 2, 2, 3, 2, 3, 2, 4, 4, 2, 1, 2, 4, 2,…
## $ q35 <dbl> 2, 3, 4, 1, 1, 1, 1, 1, 2, 1, 4, 3, 1, 2, 2, 2, 1, 4, 2, 3,…
## $ q36 <dbl> 4, 5, 4, 4, 1, 3, 1, 4, 2, 4, 3, 3, 1, 4, 4, 1, 1, 3, 3, 4,…
## $ q37 <dbl> 3, 4, 4, 3, 1, 1, 1, 3, 3, 4, 3, 3, 1, 5, 4, 2, 1, 3, 4, 3,…
## $ q38 <dbl> 3, 5, 4, 2, 1, 1, 1, 5, 2, 4, 3, 3, 2, 4, 4, 2, 1, 2, 4, 2,…
## $ q39 <dbl> 3, 3, 4, 4, 1, 3, 1, 4, 1, 1, 2, 3, 1, 1, 1, 2, 1, 3, 2, 2,…
## $ q40 <dbl> 4, 5, 2, 4, 2, 3, 2, 5, 4, 5, 2, 3, 4, 5, 5, 4, 3, 4, 4, 3,…
## $ q41 <dbl> 3, 4, 2, 4, 1, 1, 2, 1, 2, 4, 2, 3, 2, 1, 1, 2, 3, 3, 2, 3,…
## $ q42 <dbl> 3, 5, 5, 3, 1, 1, 1, 2, 4, 4, 3, 3, 1, 2, 4, 2, 3, 2, 2, 2,…
## $ q43 <dbl> 4, 5, 4, 4, 1, 3, 2, 4, 2, 5, 4, 3, 1, 5, 5, 1, 3, 3, 4, 2,…
## $ q44 <dbl> 5, 5, 4, 3, 1, 4, 2, 4, 4, 4, 4, 3, 4, 4, 5, 4, 4, 3, 2, 3,…
## $ q45 <dbl> 5, 5, 5, 4, 2, 3, 2, 4, 2, 2, 3, 3, 1, 4, 4, 4, 3, 4, 4, 4,…
## $ q46 <dbl> 4, 5, 5, 1, 1, 2, 4, 4, 2, 4, 4, 3, 2, 4, 4, 2, 3, 3, 3, 3,…
## $ q47 <dbl> 3, 5, 4, 1, 1, 1, 4, 2, 4, 4, 4, 3, 2, 2, 4, 2, 3, 4, 1, 3,…
## $ q48 <dbl> 4, 5, 5, 5, 2, 4, 4, 4, 4, 4, 3, 3, 4, 5, 5, 4, 3, 4, 4, 4,…
## $ q49 <dbl> 3, 5, 4, 4, 1, 1, 4, 2, 2, 4, 3, 3, 1, 2, 2, 2, 1, 2, 2, 3,…
The analyses below show that items q06 and q07 correlate negatively with the scale. In “real life” they should be reversed during preprocessing. Removing comments in the next chunk will accomplish this.
dat <-
data |>
mutate(Subj=as_factor(paste0("S", str_pad(1:348, width=3, side="left", pad="0"))),
Gender = factor(Gender, levels=c(1,2), labels=c("male", "female")),
# q06 = 6 - q06,
# q07 = 6 - q07
) |>
relocate(Gender:experience, .after=Subj)
You need to install.packages("psych") for good scale
statistics and more.
alpha() computes Cronbach’s alpha and lots of other
statisticsstr(aocq) shows you exactly all the results computed by
alpha()aocq$scores we extract the subjects’ scores (and
can store them in dat)aocq <- alpha(dat[, 1:18], check.keys=TRUE)
## Warning in alpha(dat[, 1:18], check.keys = TRUE): Some items were negatively correlated with total scale and were automatically reversed.
## This is indicated by a negative sign for the variable name.
aocq
##
## Reliability analysis
## Call: alpha(x = dat[, 1:18], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.89 0.9 0.92 0.33 8.9 0.0082 4.2 0.59 0.33
##
## lower alpha upper 95% confidence boundaries
## 0.88 0.89 0.91
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q01 0.89 0.90 0.92 0.34 8.6 0.0084 0.024 0.33
## q02 0.89 0.89 0.92 0.33 8.4 0.0086 0.024 0.33
## q03 0.89 0.89 0.92 0.33 8.4 0.0086 0.025 0.33
## q04 0.89 0.90 0.92 0.34 8.6 0.0085 0.024 0.34
## q05 0.89 0.89 0.92 0.33 8.5 0.0086 0.024 0.33
## q06- 0.89 0.89 0.92 0.33 8.3 0.0086 0.024 0.32
## q07- 0.90 0.90 0.92 0.35 9.1 0.0080 0.021 0.34
## q08 0.89 0.89 0.92 0.33 8.4 0.0085 0.024 0.33
## q09 0.90 0.90 0.93 0.35 9.2 0.0080 0.021 0.34
## q10 0.88 0.89 0.92 0.32 8.0 0.0090 0.023 0.31
## q11 0.89 0.89 0.92 0.32 8.1 0.0089 0.023 0.32
## q12 0.88 0.89 0.91 0.32 8.0 0.0091 0.023 0.31
## q13 0.88 0.89 0.92 0.32 8.0 0.0090 0.024 0.31
## q14 0.89 0.89 0.92 0.33 8.4 0.0085 0.022 0.32
## q15 0.89 0.89 0.92 0.33 8.3 0.0086 0.023 0.32
## q16 0.89 0.89 0.92 0.33 8.3 0.0087 0.022 0.32
## q17 0.89 0.89 0.92 0.33 8.4 0.0085 0.021 0.32
## q18 0.88 0.89 0.91 0.32 7.9 0.0090 0.022 0.32
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q01 348 0.57 0.54 0.51 0.48 4.1 1.14
## q02 348 0.63 0.61 0.59 0.55 4.2 1.13
## q03 348 0.61 0.59 0.56 0.53 4.2 1.18
## q04 348 0.54 0.53 0.49 0.48 4.6 0.83
## q05 348 0.60 0.57 0.55 0.53 4.2 1.00
## q06- 348 0.59 0.62 0.58 0.55 4.4 0.72
## q07- 348 0.41 0.38 0.33 0.32 3.8 1.10
## q08 348 0.58 0.59 0.56 0.51 4.3 0.99
## q09 348 0.36 0.36 0.30 0.28 3.4 1.03
## q10 348 0.73 0.74 0.73 0.68 4.0 0.97
## q11 348 0.70 0.71 0.70 0.65 4.3 0.85
## q12 348 0.75 0.74 0.74 0.70 3.9 1.08
## q13 348 0.72 0.72 0.70 0.67 3.9 1.06
## q14 348 0.57 0.59 0.56 0.50 4.2 1.05
## q15 348 0.60 0.63 0.61 0.56 4.5 0.74
## q16 348 0.62 0.64 0.62 0.56 4.3 0.92
## q17 348 0.57 0.60 0.58 0.52 4.4 0.75
## q18 348 0.74 0.75 0.75 0.70 4.1 0.94
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q01 0.02 0.12 0.11 0.25 0.49 0
## q02 0.03 0.10 0.09 0.24 0.55 0
## q03 0.05 0.08 0.06 0.22 0.59 0
## q04 0.01 0.03 0.06 0.17 0.72 0
## q05 0.02 0.09 0.03 0.36 0.50 0
## q06 0.50 0.41 0.06 0.02 0.00 0
## q07 0.25 0.50 0.07 0.14 0.04 0
## q08 0.03 0.04 0.04 0.30 0.58 0
## q09 0.05 0.09 0.45 0.24 0.17 0
## q10 0.01 0.05 0.26 0.27 0.42 0
## q11 0.01 0.04 0.10 0.33 0.53 0
## q12 0.02 0.09 0.25 0.28 0.36 0
## q13 0.03 0.06 0.23 0.32 0.35 0
## q14 0.05 0.02 0.12 0.33 0.48 0
## q15 0.01 0.01 0.05 0.33 0.60 0
## q16 0.01 0.03 0.14 0.29 0.53 0
## q17 0.00 0.02 0.09 0.37 0.51 0
## q18 0.01 0.05 0.18 0.31 0.45 0
str(aocq)
## List of 14
## $ total :'data.frame': 1 obs. of 9 variables:
## ..$ raw_alpha: num 0.894
## ..$ std.alpha: num 0.899
## ..$ G6(smc) : num 0.924
## ..$ average_r: num 0.33
## ..$ S/N : num 8.87
## ..$ ase : num 0.00817
## ..$ mean : num 4.15
## ..$ sd : num 0.588
## ..$ median_r : num 0.329
## $ alpha.drop :'data.frame': 18 obs. of 8 variables:
## ..$ raw_alpha: num [1:18] 0.891 0.888 0.889 0.891 0.889 ...
## ..$ std.alpha: num [1:18] 0.896 0.893 0.894 0.896 0.894 ...
## ..$ G6(smc) : num [1:18] 0.921 0.918 0.92 0.921 0.919 ...
## ..$ average_r: num [1:18] 0.335 0.33 0.331 0.336 0.333 ...
## ..$ S/N : num [1:18] 8.58 8.36 8.42 8.6 8.47 ...
## ..$ alpha se : num [1:18] 0.00844 0.00863 0.00856 0.00849 0.00859 ...
## ..$ var.r : num [1:18] 0.0236 0.0239 0.0247 0.0241 0.0237 ...
## ..$ med.r : num [1:18] 0.333 0.33 0.333 0.336 0.33 ...
## $ item.stats :'data.frame': 18 obs. of 7 variables:
## ..$ n : num [1:18] 348 348 348 348 348 348 348 348 348 348 ...
## ..$ raw.r : num [1:18] 0.565 0.626 0.609 0.539 0.597 ...
## ..$ std.r : num [1:18] 0.541 0.61 0.591 0.532 0.575 ...
## ..$ r.cor : num [1:18] 0.508 0.591 0.561 0.495 0.549 ...
## ..$ r.drop: num [1:18] 0.485 0.555 0.531 0.479 0.531 ...
## ..$ mean : num [1:18] 4.07 4.17 4.21 4.57 4.24 ...
## ..$ sd : num [1:18] 1.142 1.132 1.183 0.827 1.002 ...
## $ response.freq: num [1:18, 1:6] 0.02299 0.03161 0.05172 0.00862 0.02011 ...
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr [1:18] "q01" "q02" "q03" "q04" ...
## .. ..$ : chr [1:6] "1" "2" "3" "4" ...
## $ keys : Named num [1:18] 1 1 1 1 1 -1 -1 1 1 1 ...
## ..- attr(*, "names")= chr [1:18] "q01" "q02" "q03" "q04" ...
## $ scores : num [1:348] 4.28 4.28 4.61 4.72 4.67 ...
## $ nvar : int 18
## $ boot.ci : NULL
## $ boot : NULL
## $ Unidim :List of 1
## ..$ Unidim: num 0.741
## $ var.r : num 0.023
## $ Fit :List of 1
## ..$ Fit.off: num 0.951
## $ call : language alpha(x = dat[, 1:18], check.keys = TRUE)
## $ title : NULL
## - attr(*, "class")= chr [1:2] "psych" "alpha"
dat$aocq <- aocq$scores
We need to know the content of questions. It looks like
q06 and q07 need to be inverted. Aside from
this, the scale statistics look very good.
Cognitive
Affective
cor(dat[, 1:6])
## q01 q02 q03 q04 q05 q06
## q01 1.0000000 0.4411644 0.4479557 0.3399310 0.5397167 -0.2608942
## q02 0.4411644 1.0000000 0.4466012 0.5094128 0.5029079 -0.2782739
## q03 0.4479557 0.4466012 1.0000000 0.4937163 0.4830848 -0.3288808
## q04 0.3399310 0.5094128 0.4937163 1.0000000 0.3947097 -0.2702737
## q05 0.5397167 0.5029079 0.4830848 0.3947097 1.0000000 -0.2865384
## q06 -0.2608942 -0.2782739 -0.3288808 -0.2702737 -0.2865384 1.0000000
cog <- psych::alpha(dat[, 1:6], check.keys=TRUE)
## Warning in psych::alpha(dat[, 1:6], check.keys = TRUE): Some items were negatively correlated with total scale and were automatically reversed.
## This is indicated by a negative sign for the variable name.
cog
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 1:6], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.8 0.8 0.78 0.4 4 0.016 4.3 0.72 0.44
##
## lower alpha upper 95% confidence boundaries
## 0.77 0.8 0.83
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q01 0.77 0.77 0.74 0.40 3.3 0.018 0.0100 0.42
## q02 0.76 0.76 0.73 0.38 3.1 0.019 0.0103 0.37
## q03 0.76 0.76 0.73 0.38 3.1 0.019 0.0120 0.37
## q04 0.77 0.77 0.74 0.40 3.4 0.018 0.0106 0.44
## q05 0.75 0.76 0.72 0.38 3.1 0.020 0.0092 0.39
## q06- 0.81 0.81 0.78 0.46 4.3 0.016 0.0035 0.47
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q01 348 0.74 0.71 0.64 0.57 4.1 1.14
## q02 348 0.76 0.75 0.69 0.61 4.2 1.13
## q03 348 0.77 0.75 0.69 0.62 4.2 1.18
## q04 348 0.69 0.71 0.63 0.56 4.6 0.83
## q05 348 0.76 0.75 0.70 0.63 4.2 1.00
## q06- 348 0.52 0.57 0.42 0.38 4.4 0.72
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q01 0.02 0.12 0.11 0.25 0.49 0
## q02 0.03 0.10 0.09 0.24 0.55 0
## q03 0.05 0.08 0.06 0.22 0.59 0
## q04 0.01 0.03 0.06 0.17 0.72 0
## q05 0.02 0.09 0.03 0.36 0.50 0
## q06 0.50 0.41 0.06 0.02 0.00 0
dat$cog <- cog$scores
Looking good!
cor(dat[, 7:12])
## q07 q08 q09 q10 q11 q12
## q07 1.0000000 -0.1636948 -0.1813667 -0.2210561 -0.1370611 -0.2133496
## q08 -0.1636948 1.0000000 0.2760084 0.3681659 0.4501460 0.3643560
## q09 -0.1813667 0.2760084 1.0000000 0.1815702 0.1552254 0.2644436
## q10 -0.2210561 0.3681659 0.1815702 1.0000000 0.5469128 0.4214009
## q11 -0.1370611 0.4501460 0.1552254 0.5469128 1.0000000 0.6201053
## q12 -0.2133496 0.3643560 0.2644436 0.4214009 0.6201053 1.0000000
aff <- psych::alpha(dat[, 7:12], check.keys=TRUE)
## Warning in psych::alpha(dat[, 7:12], check.keys = TRUE): Some items were negatively correlated with total scale and were automatically reversed.
## This is indicated by a negative sign for the variable name.
aff
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 7:12], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.71 0.72 0.72 0.3 2.6 0.024 4 0.65 0.26
##
## lower alpha upper 95% confidence boundaries
## 0.67 0.71 0.76
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q07- 0.74 0.74 0.73 0.36 2.9 0.023 0.0227 0.37
## q08 0.67 0.68 0.67 0.29 2.1 0.029 0.0298 0.22
## q09 0.72 0.73 0.72 0.35 2.7 0.024 0.0270 0.37
## q10 0.65 0.66 0.65 0.28 2.0 0.029 0.0240 0.24
## q11 0.64 0.64 0.60 0.27 1.8 0.030 0.0082 0.24
## q12 0.63 0.65 0.63 0.27 1.8 0.031 0.0199 0.20
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q07- 348 0.52 0.49 0.30 0.26 3.8 1.10
## q08 348 0.67 0.67 0.57 0.48 4.3 0.99
## q09 348 0.54 0.53 0.36 0.31 3.4 1.03
## q10 348 0.69 0.70 0.63 0.52 4.0 0.97
## q11 348 0.72 0.75 0.74 0.59 4.3 0.85
## q12 348 0.74 0.74 0.70 0.57 3.9 1.08
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q07 0.25 0.50 0.07 0.14 0.04 0
## q08 0.03 0.04 0.04 0.30 0.58 0
## q09 0.05 0.09 0.45 0.24 0.17 0
## q10 0.01 0.05 0.26 0.27 0.42 0
## q11 0.01 0.04 0.10 0.33 0.53 0
## q12 0.02 0.09 0.25 0.28 0.36 0
dat$aff <- aff$scores
A bit marginal, but still acceptable.
beh <- psych::alpha(dat[, 13:18], check.keys=TRUE)
beh
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 13:18], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.85 0.85 0.85 0.49 5.8 0.013 4.2 0.69 0.51
##
## lower alpha upper 95% confidence boundaries
## 0.82 0.85 0.87
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q13 0.83 0.84 0.82 0.51 5.2 0.014 0.0054 0.53
## q14 0.83 0.83 0.82 0.50 5.0 0.015 0.0073 0.52
## q15 0.82 0.83 0.81 0.49 4.9 0.015 0.0082 0.51
## q16 0.82 0.82 0.80 0.48 4.7 0.015 0.0043 0.51
## q17 0.83 0.83 0.81 0.50 4.9 0.015 0.0053 0.50
## q18 0.80 0.82 0.79 0.47 4.4 0.016 0.0049 0.47
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q13 348 0.74 0.72 0.63 0.59 3.9 1.06
## q14 348 0.76 0.74 0.67 0.62 4.2 1.05
## q15 348 0.74 0.76 0.69 0.63 4.5 0.74
## q16 348 0.77 0.78 0.73 0.65 4.3 0.92
## q17 348 0.72 0.75 0.69 0.62 4.4 0.75
## q18 348 0.82 0.81 0.77 0.71 4.1 0.94
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q13 0.03 0.06 0.23 0.32 0.35 0
## q14 0.05 0.02 0.12 0.33 0.48 0
## q15 0.01 0.01 0.05 0.33 0.60 0
## q16 0.01 0.03 0.14 0.29 0.53 0
## q17 0.00 0.02 0.09 0.37 0.51 0
## q18 0.01 0.05 0.18 0.31 0.45 0
dat$beh <- beh$scores
Looking good!
inno <- psych::alpha(dat[, 19:26], check.keys=TRUE)
inno
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 19:26], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.83 0.84 0.85 0.39 5.2 0.014 4.2 0.55 0.44
##
## lower alpha upper 95% confidence boundaries
## 0.8 0.83 0.86
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q19 0.86 0.86 0.86 0.47 6.2 0.012 0.021 0.49
## q20 0.79 0.80 0.82 0.37 4.1 0.017 0.036 0.35
## q21 0.79 0.80 0.80 0.36 3.9 0.018 0.030 0.35
## q22 0.79 0.80 0.81 0.36 4.0 0.018 0.037 0.32
## q23 0.84 0.84 0.86 0.44 5.4 0.013 0.039 0.49
## q24 0.80 0.81 0.82 0.38 4.3 0.016 0.037 0.35
## q25 0.80 0.81 0.82 0.37 4.2 0.016 0.037 0.35
## q26 0.82 0.82 0.84 0.40 4.7 0.015 0.036 0.35
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q19 348 0.42 0.40 0.27 0.23 3.6 0.90
## q20 348 0.78 0.78 0.76 0.69 4.4 0.84
## q21 348 0.81 0.81 0.82 0.73 4.4 0.84
## q22 348 0.81 0.81 0.80 0.73 4.3 0.79
## q23 348 0.54 0.52 0.40 0.37 3.8 0.89
## q24 348 0.72 0.73 0.69 0.61 4.3 0.75
## q25 348 0.75 0.77 0.74 0.67 4.6 0.65
## q26 348 0.64 0.65 0.59 0.52 4.4 0.80
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q19 0.02 0.05 0.46 0.30 0.17 0
## q20 0.01 0.04 0.08 0.27 0.60 0
## q21 0.00 0.05 0.09 0.31 0.55 0
## q22 0.00 0.02 0.14 0.35 0.49 0
## q23 0.01 0.05 0.28 0.42 0.24 0
## q24 0.00 0.03 0.09 0.43 0.46 0
## q25 0.00 0.02 0.02 0.28 0.68 0
## q26 0.01 0.02 0.08 0.34 0.54 0
dat$inno <- inno$scores
Looking good!
hppy <- psych::alpha(dat[, 27:49], check.keys=TRUE)
hppy
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 27:49], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.94 0.94 0.96 0.4 15 0.0048 3.1 0.72 0.4
##
## lower alpha upper 95% confidence boundaries
## 0.93 0.94 0.95
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q27 0.94 0.94 0.96 0.41 15 0.0048 0.014 0.41
## q28 0.94 0.94 0.96 0.41 15 0.0049 0.017 0.41
## q29 0.94 0.94 0.96 0.40 15 0.0050 0.017 0.40
## q30 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q31 0.94 0.94 0.96 0.40 15 0.0050 0.015 0.40
## q32 0.94 0.94 0.96 0.40 15 0.0049 0.016 0.40
## q33 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q34 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q35 0.94 0.94 0.96 0.41 15 0.0049 0.016 0.40
## q36 0.93 0.93 0.96 0.39 14 0.0051 0.016 0.39
## q37 0.93 0.93 0.96 0.39 14 0.0051 0.016 0.39
## q38 0.94 0.94 0.96 0.40 15 0.0050 0.015 0.40
## q39 0.93 0.94 0.96 0.40 15 0.0051 0.016 0.39
## q40 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q41 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q42 0.93 0.93 0.96 0.40 14 0.0051 0.016 0.39
## q43 0.94 0.94 0.96 0.40 15 0.0050 0.016 0.40
## q44 0.94 0.94 0.96 0.41 15 0.0049 0.016 0.40
## q45 0.94 0.94 0.96 0.41 15 0.0048 0.015 0.41
## q46 0.94 0.94 0.96 0.40 15 0.0050 0.017 0.40
## q47 0.94 0.94 0.96 0.41 15 0.0049 0.016 0.41
## q48 0.94 0.94 0.96 0.40 15 0.0049 0.016 0.40
## q49 0.94 0.94 0.96 0.41 15 0.0049 0.016 0.40
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q27 348 0.52 0.51 0.49 0.46 3.7 1.20
## q28 348 0.61 0.61 0.59 0.57 2.8 1.08
## q29 348 0.65 0.65 0.64 0.61 2.7 1.18
## q30 348 0.65 0.64 0.64 0.61 3.0 1.21
## q31 348 0.69 0.68 0.68 0.65 2.8 1.30
## q32 348 0.63 0.62 0.61 0.59 2.5 1.11
## q33 348 0.70 0.70 0.69 0.67 2.8 1.06
## q34 348 0.66 0.66 0.64 0.62 2.9 1.03
## q35 348 0.60 0.60 0.58 0.55 2.7 1.24
## q36 348 0.78 0.78 0.77 0.75 3.0 1.13
## q37 348 0.78 0.77 0.77 0.75 3.1 1.06
## q38 348 0.67 0.67 0.66 0.63 2.8 1.10
## q39 348 0.74 0.73 0.72 0.71 2.7 1.18
## q40 348 0.68 0.68 0.68 0.64 3.3 1.06
## q41 348 0.67 0.67 0.66 0.63 2.7 1.17
## q42 348 0.77 0.77 0.76 0.74 3.1 1.11
## q43 348 0.68 0.68 0.67 0.64 3.6 1.04
## q44 348 0.55 0.56 0.54 0.51 3.8 0.91
## q45 348 0.53 0.54 0.52 0.48 3.1 1.12
## q46 348 0.66 0.66 0.65 0.62 3.5 1.04
## q47 348 0.60 0.61 0.60 0.56 3.4 0.99
## q48 348 0.62 0.63 0.62 0.58 3.5 0.88
## q49 348 0.61 0.62 0.60 0.57 3.5 0.97
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q27 0.05 0.15 0.17 0.30 0.34 0
## q28 0.15 0.20 0.43 0.16 0.06 0
## q29 0.22 0.20 0.34 0.18 0.06 0
## q30 0.15 0.22 0.18 0.39 0.06 0
## q31 0.25 0.17 0.22 0.29 0.07 0
## q32 0.16 0.44 0.20 0.12 0.07 0
## q33 0.14 0.18 0.46 0.15 0.07 0
## q34 0.12 0.16 0.48 0.18 0.06 0
## q35 0.18 0.32 0.19 0.22 0.09 0
## q36 0.11 0.18 0.38 0.22 0.11 0
## q37 0.09 0.18 0.39 0.25 0.08 0
## q38 0.09 0.43 0.18 0.24 0.06 0
## q39 0.18 0.25 0.32 0.18 0.08 0
## q40 0.07 0.12 0.34 0.34 0.13 0
## q41 0.13 0.38 0.20 0.20 0.09 0
## q42 0.10 0.15 0.39 0.26 0.11 0
## q43 0.03 0.12 0.22 0.43 0.20 0
## q44 0.03 0.05 0.18 0.57 0.17 0
## q45 0.04 0.31 0.26 0.25 0.14 0
## q46 0.02 0.18 0.20 0.43 0.16 0
## q47 0.03 0.18 0.28 0.41 0.11 0
## q48 0.02 0.10 0.35 0.43 0.11 0
## q49 0.05 0.11 0.18 0.57 0.09 0
dat$hppy <- hppy$scores
Looking good!
lrn <- psych::alpha(dat[, 27:30], check.keys=TRUE)
lrn
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 27:30], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.82 0.82 0.79 0.53 4.6 0.016 3 0.94 0.51
##
## lower alpha upper 95% confidence boundaries
## 0.79 0.82 0.85
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q27 0.80 0.80 0.74 0.56 3.9 0.019 0.01121 0.53
## q28 0.79 0.79 0.73 0.56 3.8 0.019 0.01125 0.50
## q29 0.75 0.75 0.66 0.50 3.0 0.023 0.00028 0.50
## q30 0.76 0.76 0.68 0.51 3.2 0.022 0.00038 0.51
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q27 348 0.78 0.78 0.65 0.59 3.7 1.2
## q28 348 0.77 0.78 0.66 0.60 2.8 1.1
## q29 348 0.84 0.84 0.78 0.70 2.7 1.2
## q30 348 0.83 0.83 0.76 0.68 3.0 1.2
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q27 0.05 0.15 0.17 0.30 0.34 0
## q28 0.15 0.20 0.43 0.16 0.06 0
## q29 0.22 0.20 0.34 0.18 0.06 0
## q30 0.15 0.22 0.18 0.39 0.06 0
dat$lrn <- lrn$scores
sop <- psych::alpha(dat[, 31:35], check.keys=TRUE)
sop
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 31:35], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.83 0.84 0.82 0.5 5.1 0.015 2.7 0.89 0.56
##
## lower alpha upper 95% confidence boundaries
## 0.8 0.83 0.86
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q31 0.79 0.80 0.76 0.50 3.9 0.018 0.00783 0.50
## q32 0.77 0.79 0.76 0.48 3.7 0.020 0.02092 0.52
## q33 0.77 0.78 0.75 0.47 3.6 0.020 0.02060 0.51
## q34 0.78 0.79 0.77 0.49 3.8 0.019 0.01809 0.50
## q35 0.85 0.85 0.81 0.59 5.7 0.013 0.00062 0.59
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q31 348 0.80 0.79 0.74 0.65 2.8 1.3
## q32 348 0.82 0.82 0.76 0.70 2.5 1.1
## q33 348 0.82 0.82 0.77 0.71 2.8 1.1
## q34 348 0.79 0.80 0.74 0.68 2.9 1.0
## q35 348 0.66 0.65 0.51 0.45 2.7 1.2
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q31 0.25 0.17 0.22 0.29 0.07 0
## q32 0.16 0.44 0.20 0.12 0.07 0
## q33 0.14 0.18 0.46 0.15 0.07 0
## q34 0.12 0.16 0.48 0.18 0.06 0
## q35 0.18 0.32 0.19 0.22 0.09 0
dat$sop <- sop$scores
prt <- psych::alpha(dat[, 36:38], check.keys=TRUE)
prt
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 36:38], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.87 0.87 0.82 0.68 6.5 0.013 3 0.97 0.65
##
## lower alpha upper 95% confidence boundaries
## 0.84 0.87 0.89
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q36 0.79 0.79 0.65 0.65 3.7 0.023 NA 0.65
## q37 0.78 0.78 0.64 0.64 3.5 0.024 NA 0.64
## q38 0.86 0.87 0.76 0.76 6.4 0.014 NA 0.76
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q36 348 0.90 0.90 0.84 0.77 3.0 1.1
## q37 348 0.90 0.90 0.84 0.78 3.1 1.1
## q38 348 0.86 0.86 0.73 0.68 2.8 1.1
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q36 0.11 0.18 0.38 0.22 0.11 0
## q37 0.09 0.18 0.39 0.25 0.08 0
## q38 0.09 0.43 0.18 0.24 0.06 0
dat$prt <- prt$scores
pth <- psych::alpha(dat[, 39:42], check.keys=TRUE)
pth
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 39:42], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.84 0.84 0.81 0.58 5.4 0.014 3 0.93 0.57
##
## lower alpha upper 95% confidence boundaries
## 0.82 0.84 0.87
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q39 0.81 0.81 0.75 0.59 4.4 0.017 0.0023 0.57
## q40 0.82 0.82 0.76 0.61 4.7 0.016 0.0012 0.60
## q41 0.79 0.79 0.71 0.55 3.7 0.020 0.0031 0.56
## q42 0.78 0.78 0.71 0.55 3.6 0.020 0.0024 0.57
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q39 348 0.82 0.81 0.71 0.65 2.7 1.2
## q40 348 0.78 0.79 0.68 0.63 3.3 1.1
## q41 348 0.85 0.85 0.78 0.72 2.7 1.2
## q42 348 0.85 0.85 0.79 0.72 3.1 1.1
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q39 0.18 0.25 0.32 0.18 0.08 0
## q40 0.07 0.12 0.34 0.34 0.13 0
## q41 0.13 0.38 0.20 0.20 0.09 0
## q42 0.10 0.15 0.39 0.26 0.11 0
dat$pth <- pth$scores
mfw <- psych::alpha(dat[, 43:45], check.keys=TRUE)
mfw
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 43:45], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.62 0.63 0.57 0.37 1.7 0.036 3.5 0.77 0.34
##
## lower alpha upper 95% confidence boundaries
## 0.55 0.62 0.69
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q43 0.50 0.51 0.34 0.34 1.02 0.053 NA 0.34
## q44 0.36 0.36 0.22 0.22 0.56 0.069 NA 0.22
## q45 0.70 0.70 0.54 0.54 2.35 0.032 NA 0.54
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q43 348 0.77 0.77 0.61 0.44 3.6 1.04
## q44 348 0.80 0.82 0.71 0.56 3.8 0.91
## q45 348 0.71 0.68 0.39 0.31 3.1 1.12
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q43 0.03 0.12 0.22 0.43 0.20 0
## q44 0.03 0.05 0.18 0.57 0.17 0
## q45 0.04 0.31 0.26 0.25 0.14 0
dat$mwf <- mfw$scores
wrk <- psych::alpha(dat[, 46:49], check.keys=TRUE)
wrk
##
## Reliability analysis
## Call: psych::alpha(x = dat[, 46:49], check.keys = TRUE)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.82 0.82 0.78 0.53 4.5 0.015 3.5 0.78 0.51
##
## lower alpha upper 95% confidence boundaries
## 0.79 0.82 0.85
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## q46 0.75 0.75 0.68 0.50 3.0 0.023 0.0121 0.44
## q47 0.73 0.73 0.66 0.48 2.7 0.024 0.0086 0.43
## q48 0.84 0.84 0.78 0.63 5.1 0.015 0.0027 0.62
## q49 0.76 0.76 0.71 0.52 3.2 0.022 0.0221 0.44
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## q46 348 0.85 0.84 0.78 0.70 3.5 1.04
## q47 348 0.86 0.85 0.81 0.73 3.4 0.99
## q48 348 0.69 0.71 0.54 0.49 3.5 0.88
## q49 348 0.82 0.82 0.73 0.66 3.5 0.97
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## q46 0.02 0.18 0.20 0.43 0.16 0
## q47 0.03 0.18 0.28 0.41 0.11 0
## q48 0.02 0.10 0.35 0.43 0.11 0
## q49 0.05 0.11 0.18 0.57 0.09 0
dat$wrk <- wrk$scores
Often we don’t really need item level information anymore. Here we simple extract the subject information and the scale and subscale scores into the dataframe we are going to use fpr descriptive statistics in reports, figures, and as input to some inferential statistics.
dat_w <-
dat |>
select(Subj, Gender, experience:wrk) |>
mutate(cog_c = cog - 3,
aff_c = aff - 3,
beh_c = beh - 3)
From the wide format, we may need to go to the long format.
m1_inno <- lm(inno ~ 1 + cog + aff + beh, data=dat_w)
summary(m1_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog + aff + beh, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.39986 -0.16262 -0.06299 0.20134 1.00713
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.470126 0.139661 10.526 < 2e-16 ***
## cog 0.132842 0.034787 3.819 0.000159 ***
## aff -0.005108 0.049171 -0.104 0.917325
## beh 0.522065 0.040294 12.956 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3631 on 344 degrees of freedom
## Multiple R-squared: 0.5658, Adjusted R-squared: 0.5621
## F-statistic: 149.4 on 3 and 344 DF, p-value: < 2.2e-16
contrasts(dat_w$Gender) <- contr.sum(2)
m2_inno <- lm(inno ~ 1 + cog + aff + beh + Gender, data=dat_w)
summary(m2_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog + aff + beh + Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.38483 -0.17133 -0.05772 0.20396 1.01521
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.466565 0.140051 10.472 < 2e-16 ***
## cog 0.131315 0.034995 3.752 0.000206 ***
## aff -0.006860 0.049384 -0.139 0.889599
## beh 0.526663 0.041637 12.649 < 2e-16 ***
## Gender1 -0.009338 0.020932 -0.446 0.655782
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3636 on 343 degrees of freedom
## Multiple R-squared: 0.5661, Adjusted R-squared: 0.561
## F-statistic: 111.9 on 4 and 343 DF, p-value: < 2.2e-16
m3_inno <- lm(inno ~ 1 + (cog + aff + beh)*Gender, data=dat_w)
summary(m3_inno)
##
## Call:
## lm(formula = inno ~ 1 + (cog + aff + beh) * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.33394 -0.14249 -0.04941 0.18058 1.07076
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.38404 0.14499 9.545 < 2e-16 ***
## cog 0.15586 0.04145 3.760 0.00020 ***
## aff 0.06356 0.05528 1.150 0.25106
## beh 0.45118 0.04912 9.185 < 2e-16 ***
## Gender1 0.08460 0.14499 0.583 0.55997
## cog:Gender1 -0.02056 0.04145 -0.496 0.62020
## aff:Gender1 -0.14161 0.05528 -2.562 0.01085 *
## beh:Gender1 0.13431 0.04912 2.734 0.00658 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3603 on 340 degrees of freedom
## Multiple R-squared: 0.5776, Adjusted R-squared: 0.5689
## F-statistic: 66.43 on 7 and 340 DF, p-value: < 2.2e-16
anova(m1_inno, m2_inno, m3_inno)
## Analysis of Variance Table
##
## Model 1: inno ~ 1 + cog + aff + beh
## Model 2: inno ~ 1 + cog + aff + beh + Gender
## Model 3: inno ~ 1 + (cog + aff + beh) * Gender
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 344 45.364
## 2 343 45.338 1 0.02631 0.2027 0.65285
## 3 340 44.132 3 1.20563 3.0961 0.02703 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# cognition
p_cog <-
dat_w |>
ggplot(aes(x=cog, y= inno, group=Gender, color=Gender)) +
geom_jitter() + geom_smooth(method="lm") +
scale_color_manual("", values=c("blue", "red")) +
scale_y_continuous("Rating of organization innovation", breaks=1:5) +
scale_x_continuous("Attitude to cognitive change", breaks=1:5) +
coord_fixed(ratio=1, xlim=c(1,5.5), ylim=c(1,5.5)) +
theme_bw()
p_cog
## `geom_smooth()` using formula 'y ~ x'
m3_inno_cog <- lm(inno ~ 1 + cog*Gender, data=dat_w)
summary(m3_inno_cog)
##
## Call:
## lm(formula = inno ~ 1 + cog * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.6008 -0.2956 0.1062 0.2758 1.5324
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.41522 0.16696 14.466 < 2e-16 ***
## cog 0.41788 0.03843 10.875 < 2e-16 ***
## Gender1 0.61404 0.16696 3.678 0.000273 ***
## cog:Gender1 -0.12565 0.03843 -3.270 0.001185 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4716 on 344 degrees of freedom
## Multiple R-squared: 0.2679, Adjusted R-squared: 0.2615
## F-statistic: 41.96 on 3 and 344 DF, p-value: < 2.2e-16
# affect
p_aff <-
dat_w |>
ggplot(aes(x=aff, y= inno, group=Gender, color=Gender)) +
geom_jitter() + geom_smooth(method="lm") +
scale_color_manual("", values=c("blue", "red")) +
scale_y_continuous("Rating of organization innovation", breaks=1:5) +
scale_x_continuous("Attitude to affective change", breaks=1:5) +
coord_fixed(ratio=1, xlim=c(1,5.5), ylim=c(1,5.5)) +
theme_bw()
p_aff
## `geom_smooth()` using formula 'y ~ x'
m3_inno_aff <- lm(inno ~ 1 + aff*Gender, data=dat_w)
summary(m3_inno_aff)
##
## Call:
## lm(formula = inno ~ 1 + aff * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.29207 -0.21021 0.07796 0.24665 1.17521
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.15890 0.15632 13.810 < 2e-16 ***
## aff 0.51979 0.03922 13.253 < 2e-16 ***
## Gender1 0.44844 0.15632 2.869 0.00438 **
## aff:Gender1 -0.10165 0.03922 -2.592 0.00995 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4437 on 344 degrees of freedom
## Multiple R-squared: 0.3518, Adjusted R-squared: 0.3462
## F-statistic: 62.24 on 3 and 344 DF, p-value: < 2.2e-16
# behavior
p_beh <-
dat_w |>
ggplot(aes(x=beh, y= inno, group=Gender, color=Gender)) +
geom_jitter() + geom_smooth(method="lm") +
scale_y_continuous("Rating of organization innovation", breaks=1:5) +
scale_x_continuous("Attitude to behavioral change", breaks=1:5) +
scale_color_manual("", values=c("blue", "red")) +
coord_fixed(ratio=1, xlim=c(1,5.5), ylim=c(1,5.5)) +
theme_bw()
p_beh
## `geom_smooth()` using formula 'y ~ x'
m3_inno_beh <- lm(inno ~ 1 + beh*Gender, data=dat_w)
summary(m3_inno_beh)
##
## Call:
## lm(formula = inno ~ 1 + beh * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.44848 -0.17197 -0.03942 0.20303 1.06293
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.741954 0.128496 13.556 <2e-16 ***
## beh 0.588567 0.030553 19.264 <2e-16 ***
## Gender1 -0.032244 0.128496 -0.251 0.802
## beh:Gender1 0.002376 0.030553 0.078 0.938
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3721 on 344 degrees of freedom
## Multiple R-squared: 0.5441, Adjusted R-squared: 0.5401
## F-statistic: 136.9 on 3 and 344 DF, p-value: < 2.2e-16
The profile of significant effects in m3_inno does not
agree with the zero-order relations of these variables, that is when
they are assessed independently of each other. This means when the three
IVs are in the model they “interfere” with each other. They generate
what is known as a suppressor constellation. Suppressor constellations
often suggest that there may be an interaction lurking in the data.
Let’s look at the three plots at the same time.
dat_l <-
dat_w |>
pivot_longer(cog:beh, names_to = "Attitude", values_to = "rating") |>
select(Subj, Gender, Attitude, rating, inno) |>
mutate(Attitude = factor(Attitude, levels=c("cog", "aff", "beh")),
rating_c = rating - 3)
dat_l |>
mutate(Attitude = fct_recode(Attitude, Cognition = "cog", Affect = "aff", Behavior = "beh" ),
Gender = fct_rev(Gender)) |>
ggplot(aes(x=rating, y=inno, group=Gender, color=Gender)) +
geom_jitter() +
geom_smooth(method="lm", formula=y ~ 1 + poly(x,1)) +
facet_grid(. ~ Attitude) +
scale_x_continuous("Rating", breaks=1:5) +
scale_y_continuous("Innovation", breaks=1:5) +
scale_color_manual("", values=c("red", "blue")) +
coord_fixed(ratio=2, xlim=c(1, 5.5), ylim=c(1,5.5)) +
theme_bw() + theme(legend.position=c(0.99, 0.01), legend.justification=c(0.99, 0.01))
Let’s look at scatterplot matrices
dat_w |>
ggscatmat(columns = c("inno", "cog", "aff", "beh"), color = "Gender", alpha = 1) +
theme(legend.position="top", legend.title=element_blank()) +
guides(colour = guide_legend(override.aes = list(size=3))) +
scale_color_manual("", values=c("blue", "red")) +
theme_bw() + theme(legend.position = "top")
# an alternative with ellipses
scatterplotMatrix(~ inno + cog + aff + beh | Gender, data=dat_w,
smooth=FALSE, regLine=FALSE, ellipse=TRUE, legend = FALSE )
check_model(m3_inno)
m3b_inno <- lm(inno ~ 1 + (cog_c + aff_c + beh_c)*Gender, data=dat_w)
summary(m3b_inno)
##
## Call:
## lm(formula = inno ~ 1 + (cog_c + aff_c + beh_c) * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.33394 -0.14249 -0.04941 0.18058 1.07076
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.395833 0.046616 72.848 < 2e-16 ***
## cog_c 0.155855 0.041453 3.760 0.00020 ***
## aff_c 0.063558 0.055281 1.150 0.25106
## beh_c 0.451185 0.049120 9.185 < 2e-16 ***
## Gender1 0.001025 0.046616 0.022 0.98247
## cog_c:Gender1 -0.020561 0.041453 -0.496 0.62020
## aff_c:Gender1 -0.141611 0.055281 -2.562 0.01085 *
## beh_c:Gender1 0.134315 0.049120 2.734 0.00658 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3603 on 340 degrees of freedom
## Multiple R-squared: 0.5776, Adjusted R-squared: 0.5689
## F-statistic: 66.43 on 7 and 340 DF, p-value: < 2.2e-16
check_model(m3b_inno)
m4_inno <- lm(inno ~ 1 + cog_c + aff_c*beh_c, data=dat_w)
summary(m4_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog_c + aff_c * beh_c, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.40800 -0.18369 -0.06714 0.18725 1.09594
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.35138 0.05103 65.675 < 2e-16 ***
## cog_c 0.15197 0.03516 4.322 2.03e-05 ***
## aff_c 0.11928 0.06661 1.791 0.0742 .
## beh_c 0.59727 0.04846 12.326 < 2e-16 ***
## aff_c:beh_c -0.11211 0.04094 -2.738 0.0065 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3598 on 343 degrees of freedom
## Multiple R-squared: 0.5751, Adjusted R-squared: 0.5702
## F-statistic: 116.1 on 4 and 343 DF, p-value: < 2.2e-16
anova(m1_inno, m4_inno)
## Analysis of Variance Table
##
## Model 1: inno ~ 1 + cog + aff + beh
## Model 2: inno ~ 1 + cog_c + aff_c * beh_c
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 344 45.364
## 2 343 44.393 1 0.97046 7.4981 0.006499 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m5_inno <- lm(inno ~ 1 + cog_c + aff_c*beh_c + aff_c*Gender,
data=dat_w)
summary(m5_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog_c + aff_c * beh_c + aff_c * Gender,
## data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.40124 -0.18158 -0.05801 0.19285 1.07915
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.35257 0.05122 65.451 < 2e-16 ***
## cog_c 0.14914 0.03558 4.191 3.54e-05 ***
## aff_c 0.11955 0.06723 1.778 0.0763 .
## beh_c 0.59097 0.05108 11.570 < 2e-16 ***
## Gender1 0.01434 0.03781 0.379 0.7047
## aff_c:beh_c -0.10409 0.04278 -2.433 0.0155 *
## aff_c:Gender1 -0.02078 0.03346 -0.621 0.5349
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3606 on 341 degrees of freedom
## Multiple R-squared: 0.5757, Adjusted R-squared: 0.5682
## F-statistic: 77.11 on 6 and 341 DF, p-value: < 2.2e-16
anova(m1_inno, m4_inno, m5_inno)
## Analysis of Variance Table
##
## Model 1: inno ~ 1 + cog + aff + beh
## Model 2: inno ~ 1 + cog_c + aff_c * beh_c
## Model 3: inno ~ 1 + cog_c + aff_c * beh_c + aff_c * Gender
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 344 45.364
## 2 343 44.393 1 0.97046 7.4642 0.006621 **
## 3 341 44.335 2 0.05847 0.2248 0.798757
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
With the interaction between aff and beh in
the model, Gender is no longer significant. Perhaps we have
been looking at the wrong model.
aff x behLet’s visualize the aff x beh
interaction.
When two continuous variables interact, one option is to turn one of
them into a factor and put it in the group. We convert all
of three variables into factors.
There are three options
cut_interval()cut_number()Looking at the figure, it seems there are very few values below 3.
Let’s got with cut_nunber().
dat_w$CogN = cut_number(dat_w$cog, n=3)
dat_w$AffN = cut_number(dat_w$aff, n=3)
dat_w$BehN = cut_number(dat_w$beh, n=3)
dat_w$BehI = cut_interval(dat_w$beh, n=3)
# checks
dat_w |> group_by(BehN) |> summarise(N=n(), aff_M=mean(aff))
## # A tibble: 3 × 3
## BehN N aff_M
## <fct> <int> <dbl>
## 1 [1.83,4] 132 3.47
## 2 (4,4.67] 110 3.98
## 3 (4.67,5] 106 4.53
dat_w |> group_by(BehI) |> summarise(N=n(), aff_M=mean(aff))
## # A tibble: 3 × 3
## BehI N aff_M
## <fct> <int> <dbl>
## 1 [1.83,2.89] 18 2.86
## 2 (2.89,3.94] 86 3.51
## 3 (3.94,5] 244 4.19
And the graph:
dat_w |>
ggplot(aes(x=aff, y=inno, group=BehN, color=BehN)) +
geom_jitter() + geom_smooth(method="lm") +
scale_color_manual("Beh Bins", values = c("blue", "orange", "red")) +
facet_grid(. ~ Gender) +
theme_bw()
## `geom_smooth()` using formula 'y ~ x'
dat_w |>
ggplot(aes(x=beh, y=inno, group=AffN, color=AffN)) +
geom_jitter() + geom_smooth(method="lm") +
scale_color_manual("Aff Bins", values = c("blue", "orange", "red")) +
facet_grid(. ~ Gender) +
theme_bw()
## `geom_smooth()` using formula 'y ~ x'
dat_w |> group_by(AffN, Gender) |> summarise(N=n(), aff_M=mean(aff))
## `summarise()` has grouped output by 'AffN'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups: AffN [3]
## AffN Gender N aff_M
## <fct> <fct> <int> <dbl>
## 1 [2.33,3.67] male 80 3.25
## 2 [2.33,3.67] female 55 3.33
## 3 (3.67,4.5] male 103 4.23
## 4 (3.67,4.5] female 64 4.27
## 5 (4.5,5] male 36 4.88
## 6 (4.5,5] female 10 4.8
# other variables?
dat_w |> group_by(BehN, Gender) |> summarise(N=n(), aff_M=mean(aff)) # ok
## `summarise()` has grouped output by 'BehN'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups: BehN [3]
## BehN Gender N aff_M
## <fct> <fct> <int> <dbl>
## 1 [1.83,4] male 65 3.45
## 2 [1.83,4] female 67 3.50
## 3 (4,4.67] male 73 3.82
## 4 (4,4.67] female 37 4.29
## 5 (4.67,5] male 81 4.55
## 6 (4.67,5] female 25 4.47
dat_w |> group_by(CogN, Gender) |> summarise(N=n(), aff_M=mean(aff)) # ok
## `summarise()` has grouped output by 'CogN'. You can override using the
## `.groups` argument.
## # A tibble: 6 × 4
## # Groups: CogN [3]
## CogN Gender N aff_M
## <fct> <fct> <int> <dbl>
## 1 [1.5,4] male 75 3.49
## 2 [1.5,4] female 42 3.38
## 3 (4,4.83] male 82 4.05
## 4 (4,4.83] female 51 3.94
## 5 (4.83,5] male 62 4.49
## 6 (4.83,5] female 36 4.50
Solution: Don’t include aff now. Try to
understand why male and female responded so differently. Start over.
m6_inno <- lm(inno ~ 1 + cog_c + beh_c, data=dat_w)
summary(m6_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog_c + beh_c, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.40134 -0.16247 -0.06155 0.20279 1.00553
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.42000 0.04467 76.553 < 2e-16 ***
## cog_c 0.13112 0.03053 4.295 2.28e-05 ***
## beh_c 0.51949 0.03170 16.390 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3626 on 345 degrees of freedom
## Multiple R-squared: 0.5658, Adjusted R-squared: 0.5633
## F-statistic: 224.8 on 2 and 345 DF, p-value: < 2.2e-16
m7_inno <- lm(inno ~ 1 + (cog_c + beh_c)*Gender, data=dat_w)
summary(m7_inno)
##
## Call:
## lm(formula = inno ~ 1 + (cog_c + beh_c) * Gender, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.38254 -0.16598 -0.06307 0.19797 1.10276
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.401568 0.046743 72.772 < 2e-16 ***
## cog_c 0.166786 0.038808 4.298 2.25e-05 ***
## beh_c 0.490151 0.038492 12.734 < 2e-16 ***
## Gender1 0.006464 0.046743 0.138 0.890
## cog_c:Gender1 -0.059038 0.038808 -1.521 0.129
## beh_c:Gender1 0.055485 0.038492 1.441 0.150
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3627 on 342 degrees of freedom
## Multiple R-squared: 0.5695, Adjusted R-squared: 0.5632
## F-statistic: 90.48 on 5 and 342 DF, p-value: < 2.2e-16
anova(m6_inno, m7_inno)
## Analysis of Variance Table
##
## Model 1: inno ~ 1 + cog_c + beh_c
## Model 2: inno ~ 1 + (cog_c + beh_c) * Gender
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 345 45.365
## 2 342 44.984 3 0.38144 0.9667 0.4086
m8_inno <- lm(inno ~ 1 + cog_c*beh_c, data=dat_w)
summary(m8_inno)
##
## Call:
## lm(formula = inno ~ 1 + cog_c * beh_c, data = dat_w)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.38626 -0.18688 -0.05642 0.18680 1.08387
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.27753 0.07230 45.333 < 2e-16 ***
## cog_c 0.26862 0.06290 4.271 2.52e-05 ***
## beh_c 0.65478 0.06269 10.444 < 2e-16 ***
## cog_c:beh_c -0.11073 0.04438 -2.495 0.0131 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3599 on 344 degrees of freedom
## Multiple R-squared: 0.5735, Adjusted R-squared: 0.5698
## F-statistic: 154.2 on 3 and 344 DF, p-value: < 2.2e-16
anova(m6_inno, m8_inno)
## Analysis of Variance Table
##
## Model 1: inno ~ 1 + cog_c + beh_c
## Model 2: inno ~ 1 + cog_c * beh_c
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 345 45.365
## 2 344 44.559 1 0.80621 6.224 0.01307 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
dat_w |>
ggplot(aes(x=beh, y=inno, group=CogN, color=CogN)) +
geom_jitter() + geom_smooth(method="lm") +
scale_color_manual("Cog Bins", values = c("blue", "orange", "red")) +
theme_bw()
## `geom_smooth()` using formula 'y ~ x'
check_model(m8_inno)
check_model(m6_inno)
This command ensures that somebody at some later time can reproduce your analysis.
sessionInfo()
## R version 4.1.2 (2021-11-01)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Monterey 12.2.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] cowplot_1.1.1 GGally_2.1.2 car_3.0-12 carData_3.0-5
## [5] performance_0.8.0 psych_2.1.9 summarytools_1.0.0 forcats_0.5.1
## [9] stringr_1.4.0 dplyr_1.0.8 purrr_0.3.4 readr_2.1.2
## [13] tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-155 matrixStats_0.61.0 fs_1.5.2 bit64_4.0.5
## [5] lubridate_1.8.0 insight_0.16.0 RColorBrewer_1.1-2 httr_1.4.2
## [9] tools_4.1.2 backports_1.4.1 bslib_0.3.1 utf8_1.2.2
## [13] R6_2.5.1 mgcv_1.8-39 DBI_1.1.2 colorspace_2.0-3
## [17] withr_2.5.0 tidyselect_1.1.2 mnormt_2.0.2 bit_4.0.4
## [21] compiler_4.1.2 cli_3.2.0 rvest_1.0.2 see_0.6.9
## [25] xml2_1.3.3 bayestestR_0.11.5 labeling_0.4.2 sass_0.4.0
## [29] scales_1.1.1 checkmate_2.0.0 digest_0.6.29 rmarkdown_2.12
## [33] base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.5.2 highr_0.9
## [37] dbplyr_2.1.1 fastmap_1.1.0 rlang_1.0.2 readxl_1.3.1
## [41] rstudioapi_0.13 pryr_0.1.5 farver_2.1.0 jquerylib_0.1.4
## [45] generics_0.1.2 jsonlite_1.8.0 vroom_1.5.7 magrittr_2.0.2
## [49] rapportools_1.0 patchwork_1.1.1 Matrix_1.4-0 Rcpp_1.0.8
## [53] munsell_0.5.0 fansi_1.0.2 abind_1.4-5 lifecycle_1.0.1
## [57] stringi_1.7.6 yaml_2.3.5 MASS_7.3-55 plyr_1.8.6
## [61] grid_4.1.2 ggrepel_0.9.1 parallel_4.1.2 crayon_1.5.0
## [65] lattice_0.20-45 splines_4.1.2 haven_2.4.3 pander_0.6.4
## [69] hms_1.1.1 magick_2.7.3 tmvnsim_1.0-2 knitr_1.37
## [73] pillar_1.7.0 tcltk_4.1.2 codetools_0.2-18 reprex_2.0.1
## [77] glue_1.6.2 evaluate_0.15 modelr_0.1.8 vctrs_0.3.8
## [81] tzdb_0.2.0 cellranger_1.1.0 gtable_0.3.0 datawizard_0.3.0
## [85] reshape_0.8.8 assertthat_0.2.1 xfun_0.30 broom_0.7.12
## [89] ellipsis_0.3.2